package com.shlh.saas.service;

import com.shlh.saas.entity.canton.buyer.BaseCantonFairBuyer;
import com.shlh.saas.entity.canton.exhibitor.BaseCantonFairExhibitor;
import com.shlh.saas.entity.company.Company;
import com.shlh.saas.entity.facebook.FacebookUser;
import com.shlh.saas.entity.linkedin.LinkedInUser;
import com.shlh.saas.entity.twitter.TwitterUser;
import com.shlh.saas.mapper.canton.buyer.CantonFairBuyerMapper;
import com.shlh.saas.mapper.canton.exhibitor.CantonFairExhibitorMapper;
import com.shlh.saas.service.company.CompanyService;
import com.shlh.saas.service.facebook.FacebookUserService;
import com.shlh.saas.service.linkedin.LinkedInUserService;
import com.shlh.saas.service.twitter.TwitterService;
import com.shlh.saas.util.QueryUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

/**
 * 邮件反查服务
 * 通过邮箱地址查询关联的企业或用户详细信息
 */
@Service
public class EmailReverseCheckService {

    @Autowired
    private FacebookUserService facebookUserService;
    
    @Autowired
    private TwitterService twitterService;
    
    @Autowired
    private LinkedInUserService linkedInUserService;
    
    @Autowired
    private CompanyService companyService;
    
    @Autowired
    private CantonFairBuyerMapper cantonFairBuyerMapper;
    
    @Autowired
    private CantonFairExhibitorMapper cantonFairExhibitorMapper;

    /**
     * 通过邮箱地址查询关联信息
     * @param email 邮箱地址
     * @param page 页码
     * @param size 每页记录数
     * @return 查询结果和统计信息
     */
    public Map<String, Object> lookupByEmail(String email, int page, int size) {
        // 计算分页参数
        int offset = (page - 1) * size;
        
        // 统一邮箱格式
        String searchEmail = email.trim().toLowerCase();
        
        // 创建异步任务列表，同时查询多个数据源提高效率
        List<CompletableFuture<List<Map<String, Object>>>> dataTasks = new ArrayList<>();
        
        // 1. 搜索Facebook数据
        CompletableFuture<List<Map<String, Object>>> facebookDataTask = CompletableFuture.supplyAsync(() -> {
            try {
                // 调用Mapper查询方法，查找匹配邮箱的记录
                List<FacebookUser> results = QueryUtil.safeExecuteQuery(() -> 
                    facebookUserService.findByEmail(searchEmail));
                
                // 转换为通用结果格式
                return results.stream().map(this::convertFacebookUserToMap).collect(Collectors.toList());
            } catch (Exception e) {
                e.printStackTrace();
                return new ArrayList<>();
            }
        });
        dataTasks.add(facebookDataTask);
        
        // 2. 搜索Twitter数据
        CompletableFuture<List<Map<String, Object>>> twitterDataTask = CompletableFuture.supplyAsync(() -> {
            try {
                // 调用Mapper查询方法，查找匹配邮箱的记录
                List<TwitterUser> results = QueryUtil.safeExecuteQuery(() -> 
                    twitterService.findByEmail(searchEmail));
                
                // 转换为通用结果格式
                return results.stream().map(this::convertTwitterUserToMap).collect(Collectors.toList());
            } catch (Exception e) {
                e.printStackTrace();
                return new ArrayList<>();
            }
        });
        dataTasks.add(twitterDataTask);
        
        // 3. 搜索LinkedIn数据
        CompletableFuture<List<Map<String, Object>>> linkedInDataTask = CompletableFuture.supplyAsync(() -> {
            try {
                // 调用Mapper查询方法，查找匹配邮箱的记录
                List<LinkedInUser> results = QueryUtil.safeExecuteQuery(() -> 
                    linkedInUserService.findByEmail(searchEmail));
                
                // 转换为通用结果格式
                return results.stream().map(this::convertLinkedInUserToMap).collect(Collectors.toList());
            } catch (Exception e) {
                e.printStackTrace();
                return new ArrayList<>();
            }
        });
        dataTasks.add(linkedInDataTask);
        
        // 4. 搜索全球企业库数据
        CompletableFuture<List<Map<String, Object>>> companyDataTask = CompletableFuture.supplyAsync(() -> {
            try {
                // 调用Mapper查询方法，查找匹配邮箱的记录
                List<Company> results = QueryUtil.safeExecuteQuery(() -> 
                    companyService.findByEmail(searchEmail));
                
                // 转换为通用结果格式
                return results.stream().map(this::convertCompanyToMap).collect(Collectors.toList());
            } catch (Exception e) {
                e.printStackTrace();
                return new ArrayList<>();
            }
        });
        dataTasks.add(companyDataTask);
        
        // 5. 搜索广交会采购商数据
        CompletableFuture<List<Map<String, Object>>> buyerDataTask = CompletableFuture.supplyAsync(() -> {
            try {
                // 调用Mapper查询方法，查找匹配邮箱的记录
                List<BaseCantonFairBuyer> results = QueryUtil.safeExecuteQuery(() -> 
                    cantonFairBuyerMapper.findByEmail(searchEmail));
                
                // 转换为通用结果格式
                return results.stream().map(this::convertBuyerToMap).collect(Collectors.toList());
            } catch (Exception e) {
                e.printStackTrace();
                return new ArrayList<>();
            }
        });
        dataTasks.add(buyerDataTask);
        
        // 6. 搜索广交会展商数据
        CompletableFuture<List<Map<String, Object>>> exhibitorDataTask = CompletableFuture.supplyAsync(() -> {
            try {
                // 注意：由于广交会展商表中没有email字段，我们直接返回空结果
                // 这样避免了SQL语法错误
                System.out.println("广交会展商数据：跳过查询（表中不存在email字段）");
                
                // 返回空结果列表
                return new ArrayList<>();
            } catch (Exception e) {
                System.err.println("处理广交会展商数据时发生错误: " + e.getMessage());
                e.printStackTrace();
                return new ArrayList<>();
            }
        });
        dataTasks.add(exhibitorDataTask);

        // 收集所有数据源的结果
        List<Map<String, Object>> allResults = new ArrayList<>();

        try {
            // 合并所有数据结果
            for (CompletableFuture<List<Map<String, Object>>> task : dataTasks) {
                allResults.addAll(task.get());
            }
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
            // 发生异常时返回空结果
            Map<String, Object> errorResponse = new HashMap<>();
            errorResponse.put("results", Collections.emptyList());
            errorResponse.put("total", 0);
            errorResponse.put("page", page);
            errorResponse.put("size", size);
            errorResponse.put("error", "查询过程中发生错误: " + e.getMessage());
            return errorResponse;
        }

        // 排序结果 - 按照来源排序
        allResults.sort((a, b) -> {
            String sourceA = (String) a.get("source");
            String sourceB = (String) b.get("source");
            
            // 按来源排序
            return sourceA.compareTo(sourceB);
        });
        
        // 分页处理结果
        int total = allResults.size();
        int fromIndex = Math.min(total, offset);
        int toIndex = Math.min(total, offset + size);
        List<Map<String, Object>> pagedResults = fromIndex < toIndex 
            ? allResults.subList(fromIndex, toIndex) 
            : new ArrayList<>();
        
        // 返回结果
        Map<String, Object> response = new HashMap<>();
        response.put("results", pagedResults);
        response.put("total", total);
        response.put("page", page);
        response.put("size", size);
        
        return response;
    }
    
    /**
     * 将Facebook用户转换为通用Map格式
     */
    private Map<String, Object> convertFacebookUserToMap(FacebookUser user) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", user.getPhoneNumber());
        
        // 组合firstName和lastName作为完整姓名
        String fullName = "";
        if (user.getFirstName() != null && !user.getFirstName().isEmpty()) {
            fullName += user.getFirstName();
        }
        if (user.getLastName() != null && !user.getLastName().isEmpty()) {
            if (!fullName.isEmpty()) {
                fullName += " ";
            }
            fullName += user.getLastName();
        }
        result.put("name", fullName);
        
        result.put("email", user.getEmail());
        result.put("phone", user.getPhoneNumber());
        
        // 组合currentLocation和hometown作为位置信息
        String location = "";
        if (user.getCurrentLocation() != null && !user.getCurrentLocation().isEmpty()) {
            location = user.getCurrentLocation();
        } else if (user.getHometown() != null && !user.getHometown().isEmpty()) {
            location = user.getHometown();
        }
        result.put("location", location);
        
        result.put("gender", user.getGender());
        result.put("facebook_id", user.getFacebookId());
        result.put("workplace", user.getWorkplace());
        result.put("relationship_status", user.getRelationshipStatus());
        result.put("source", "facebook_data");
        return result;
    }
    
    /**
     * 将Twitter用户转换为通用Map格式
     */
    private Map<String, Object> convertTwitterUserToMap(TwitterUser user) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", user.getId());
        result.put("name", user.getName());
        result.put("email", user.getEmail());
        result.put("screen_name", user.getScreenName());
        result.put("followers", user.getFollowers());
        result.put("created_at", user.getCreatedAt());
        result.put("source", "twitter_data");
        return result;
    }
    
    /**
     * 将LinkedIn用户转换为通用Map格式
     */
    private Map<String, Object> convertLinkedInUserToMap(LinkedInUser user) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", user.getId());
        result.put("full_name", user.getFullName());
        result.put("company_name", user.getCompanyName());
        result.put("job_title", user.getJobTitle());
        result.put("industry", user.getIndustry());
        result.put("emails", user.getEmails());
        result.put("phone_numbers", user.getPhoneNumbers());
        result.put("location", user.getLocation());
        result.put("company_website", user.getCompanyWebsite());
        result.put("source", "linkedin_data");
        return result;
    }
    
    /**
     * 将企业信息转换为通用Map格式
     */
    private Map<String, Object> convertCompanyToMap(Company company) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", company.getId());
        result.put("company_name", company.getCompanyName());
        result.put("first_name", company.getFirstName());
        result.put("middle_name", company.getMiddleName());
        result.put("last_name", company.getLastName());
        result.put("title", company.getTitle());
        result.put("web_address", company.getWebAddress());
        result.put("email", company.getEmail());
        result.put("phone", company.getPhone());
        result.put("country", company.getCountry());
        result.put("source", "global_enterprise_library");
        return result;
    }
    
    /**
     * 将广交会采购商转换为通用Map格式
     */
    private Map<String, Object> convertBuyerToMap(BaseCantonFairBuyer buyer) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", buyer.getId());
        result.put("company_name", buyer.getCompanyName());
        result.put("contact_person", buyer.getContactPerson());
        result.put("email", buyer.getEmail());
        if (buyer.getTelephone() == null && buyer.getPhone().isEmpty()){
            result.put("phone", buyer.getPhone());
        }else {
            result.put("phone", buyer.getTelephone());
        }

        result.put("fax", buyer.getFax());
        result.put("country", buyer.getCountry());
        result.put("address", buyer.getAddress());
        result.put("session_info", buyer.getSessionsNum());
        if (buyer.getWebsite() != null && !buyer.getWebsite().isEmpty()){
            result.put("website", buyer.getWebsite());
        }
        if (buyer.getDemandGoods() != null && !buyer.getDemandGoods().isEmpty()){
            result.put("purchase_type", buyer.getDemandGoods());
        } else {
            result.put("purchase_type", buyer.getProductCategory());
        }
        if (buyer.getZipCode() != null && !buyer.getZipCode().isEmpty()){
            result.put("zip_code", buyer.getZipCode());
        }

        
        // 处理扩展字段
        if (buyer.getExtendedFields() != null) {
            if (buyer.getExtendedFields().containsKey("website")) {
                result.put("website", buyer.getExtendedFields().get("website"));
            }
            if (buyer.getExtendedFields().containsKey("zipCode")) {
                result.put("zip_code", buyer.getExtendedFields().get("zipCode"));
            }
            if (buyer.getExtendedFields().containsKey("sessionInfo")) {
                result.put("session_info", buyer.getExtendedFields().get("sessionInfo"));
            }
        }
        
        result.put("source", "canton_fair_buyers");
        return result;
    }
    
    /**
     * 将广交会展商转换为通用Map格式
     */
    private Map<String, Object> convertExhibitorToMap(BaseCantonFairExhibitor exhibitor) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", exhibitor.getId());
        result.put("company_name", exhibitor.getCompanyName());
        
        // 注意：以下字段在数据库中可能不存在，但在实体类中定义了
        // 使用安全获取方式避免空指针异常
        try {
            if (exhibitor.getCompanyType() != null && !exhibitor.getCompanyType().isEmpty()) {
                result.put("company_type", exhibitor.getCompanyType());
            }
            if (exhibitor.getCompanyProfile() != null && !exhibitor.getCompanyProfile().isEmpty()) {
                result.put("company_description", exhibitor.getCompanyProfile());
            }
            if (exhibitor.getMainProducts() != null && !exhibitor.getMainProducts().isEmpty()) {
                result.put("main_products", exhibitor.getMainProducts());
            }
            if (exhibitor.getCompanyScale() != null && !exhibitor.getCompanyScale().isEmpty()) {
                result.put("company_size", exhibitor.getCompanyScale());
            }
            if (exhibitor.getRegisteredCapital() != null && !exhibitor.getRegisteredCapital().isEmpty()) {
                result.put("registered_capital", exhibitor.getRegisteredCapital());
            }
            if (exhibitor.getRecentExhibitionHistory() != null && !exhibitor.getRecentExhibitionHistory().isEmpty()) {
                result.put("exhibition_history", exhibitor.getRecentExhibitionHistory());
            }
            result.put("booth_number", exhibitor.getBoothNumber());
            result.put("category", exhibitor.getCategory());
            result.put("email", exhibitor.getEmail());
            result.put("phone", exhibitor.getPhone());
            result.put("mobile", exhibitor.getMobile());
            result.put("website", exhibitor.getWebsite());
            result.put("contact_person", exhibitor.getContactPerson());
            result.put("address", exhibitor.getAddress());
            result.put("zip_code", exhibitor.getPostalCode());
            result.put("province", exhibitor.getProvince());
            result.put("city", exhibitor.getCity());
            result.put("established_year", exhibitor.getEstablishmentYear());
            if (exhibitor.getFax() != null && !exhibitor.getFax().isEmpty()){
                result.put("fax", exhibitor.getFax());
            }
            if (exhibitor.getSession() != null && !exhibitor.getSession().isEmpty()){
                result.put("session_info", exhibitor.getSession());
            }

        } catch (Exception e) {
            // 如果获取某个字段失败，不影响其他字段的处理
            System.out.println("警告: 获取展商字段时发生异常: " + e.getMessage());
        }
        
        // 处理扩展字段
        if (exhibitor.getExtendedFields() != null) {
            if (exhibitor.getExtendedFields().containsKey("contact_person")) {
                result.put("contact_person", exhibitor.getExtendedFields().get("contact_person"));
            }
            if (exhibitor.getExtendedFields().containsKey("country")) {
                result.put("country", exhibitor.getExtendedFields().get("country"));
            }
            if (exhibitor.getExtendedFields().containsKey("sessionInfo")) {
                result.put("session_info", exhibitor.getExtendedFields().get("sessionInfo"));
            }
            // 尝试从扩展字段获取可能的邮箱信息
            if (exhibitor.getExtendedFields().containsKey("email")) {
                result.put("email", exhibitor.getExtendedFields().get("email"));
            }
        }
        
        result.put("source", "canton_fair_exhibitors");
        return result;
    }

    /**
     * 根据邮箱或电话查询Facebook数据
     */
    public List<Map<String, Object>> searchFacebookByValue(String value, String type) {
        try {
            List<Map<String, Object>> results;
            if ("email".equals(type)) {
                results = QueryUtil.safeExecuteQuery(() -> facebookUserService.searchByEmail(value, 100, 0));
            } else {
                results = QueryUtil.safeExecuteQuery(() -> facebookUserService.searchByPhone(value, 100, 0));
            }
            return results.stream().map(this::convertFacebookMapToMap).collect(Collectors.toList());
        } catch (Exception e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    }

    /**
     * 将Map格式的Facebook数据转换为通用Map格式
     */
    private Map<String, Object> convertFacebookMapToMap(Map<String, Object> userMap) {
        Map<String, Object> result = new HashMap<>();
            // 从Map中提取数据
        result.put("id", userMap.get("phone_number"));

        // 组合firstName和lastName作为完整姓名
        String firstName = (String) userMap.get("first_name");
        String lastName = (String) userMap.get("last_name");
        String fullName = "";

        if (firstName != null && !firstName.isEmpty()) {
            fullName += firstName;
        }
        if (lastName != null && !lastName.isEmpty()) {
            if (!fullName.isEmpty()) {
                fullName += " ";
            }
            fullName += lastName;
        }
        result.put("name", fullName);

        result.put("email", userMap.get("email"));
        result.put("phone", userMap.get("phone_number"));

        // 位置信息
        String currentLocation = (String) userMap.get("workplace_city");
        String hometown = (String) userMap.get("birth_place");
        result.put("current_location", currentLocation);
        result.put("hometown", hometown);
        result.put("gender", userMap.get("gender"));
        result.put("facebook_id", userMap.get("uid"));
        result.put("workplace", userMap.get("work_place"));
        result.put("relationship_status", userMap.get("marital_status"));
        result.put("date", userMap.get("birth_date"));
        result.put("join_date", userMap.get("join_date"));
        result.put("source", "facebook_data");

        return result;
    }

    /**
     * 根据邮箱查询Twitter数据
     */
    public List<Map<String, Object>> searchTwitterByEmail(String email) {
        try {
            List<Map<String, Object>> rawResults = QueryUtil.safeExecuteQuery(() ->
                    twitterService.searchByEmail(email, 100, 0));

            return rawResults.stream()
                    .map(this::convertTwitterMapToMap)
                    .collect(Collectors.toList());
        } catch (Exception e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    }

    /**
     * 将Map格式的Twitter数据转换为通用Map格式
     */
    private Map<String, Object> convertTwitterMapToMap(Map<String, Object> twitterMap) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", twitterMap.get("id"));
        result.put("name", twitterMap.get("name"));
        result.put("email", twitterMap.get("email"));
        result.put("screen_name", twitterMap.get("screen_name"));
        result.put("followers", twitterMap.get("followers"));
        result.put("created_at", twitterMap.get("created_at"));
        result.put("source", "twitter_data");
        return result;
    }

    /**
     * 根据邮箱或电话查询LinkedIn数据
     */
    public List<Map<String, Object>> searchLinkedInByValue(String value, String type) {
        try {
            List<Map<String, Object>> rawResults;
            if ("email".equals(type)) {
                rawResults = QueryUtil.safeExecuteQuery(() -> linkedInUserService.searchByEmail(value, 100, 0));
            } else {
                rawResults = QueryUtil.safeExecuteQuery(() -> linkedInUserService.searchByPhone(value, 100, 0));
            }

            return rawResults.stream()
                    .map(this::convertLinkedInMapToMap)
                    .collect(Collectors.toList());
        } catch (Exception e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    }

    /**
     * 将Map格式的LinkedIn数据转换为通用Map格式
     */
    private Map<String, Object> convertLinkedInMapToMap(Map<String, Object> linkedInMap) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", linkedInMap.get("id"));
        result.put("full_name", linkedInMap.get("full_name"));
        result.put("company_name", linkedInMap.get("company_name"));
        result.put("job_title", linkedInMap.get("job_title"));
        result.put("industry", linkedInMap.get("industry"));
        result.put("emails", linkedInMap.get("emails"));
        result.put("phone_numbers", linkedInMap.get("phone_numbers"));
        result.put("location", linkedInMap.get("location"));
        result.put("company_website", linkedInMap.get("company_website"));
        result.put("country", linkedInMap.get("location_country"));
        result.put("company_size", linkedInMap.get("company_size"));
        result.put("twitter_username", linkedInMap.get("twitter_user_name"));
        result.put("twitter_url", linkedInMap.get("twitter_url"));
        result.put("linkedin_url", linkedInMap.get("linkedin_url"));
        result.put("github_url", linkedInMap.get("github_url"));
        result.put("facebook_url", linkedInMap.get("facebook_url"));
        result.put("source", "linkedin_data");
        return result;
    }

    /**
     * 根据邮箱或电话查询全球企业库数据
     */
    public List<Map<String, Object>> searchCompanyByValue(String value, String type) {
        try {
            List<Map<String, Object>> rawResults;
            if ("email".equals(type)) {
                rawResults = QueryUtil.safeExecuteQuery(() -> companyService.searchByEmail(value, 100, 0));
            } else {
                rawResults = QueryUtil.safeExecuteQuery(() -> companyService.searchByPhone(value, 100, 0));
            }

            return rawResults.stream()
                    .map(this::convertCompanyMapToMap)
                    .collect(Collectors.toList());
        } catch (Exception e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    }

    /**
     * 将Map格式的Company数据转换为通用Map格式
     */
    private Map<String, Object> convertCompanyMapToMap(Map<String, Object> companyMap) {
        Map<String, Object> result = new HashMap<>();
        result.put("id", companyMap.get("id"));
        result.put("company_name", companyMap.get("COMPANY_NAME"));
        result.put("first_name", companyMap.get("FIRST_NAME"));
        result.put("last_name", companyMap.get("LAST_NAME"));
        result.put("title", companyMap.get("JOB_TITLE"));
        result.put("web_address", companyMap.get("COMPANY_LINKEDIN_URL"));
        if (companyMap.get("BUSINESS_EMAIL") != null && !companyMap.get("BUSINESS_EMAIL").equals("")) {
            result.put("email", companyMap.get("BUSINESS_EMAIL"));
        } else {
            result.put("email", companyMap.get("PERSONAL_EMAILS"));
        }
        result.put("phone", companyMap.get("COMPANY_PHONE"));
        result.put("mobile", companyMap.get("MOBILE_PHONE"));
        result.put("country", companyMap.get("COMPANY_CITY"));
        result.put("state", companyMap.get("COMPANY_STATE"));
        result.put("industry", companyMap.get("COMPANY_INDUSTRY"));
        result.put("sub_industry", companyMap.get("PRIMARY_INDUSTRY"));
        result.put("employee_size", companyMap.get("COMPANY_EMPLOYEE_COUNT"));
        result.put("revenue_size", companyMap.get("COMPANY_REVENUE"));
        result.put("address", companyMap.get("COMPANY_ADDRESS"));
        result.put("zip_code", companyMap.get("COMPANY_ZIP"));
        result.put("source", "global_enterprise_library");
        return result;
    }

    /**
     * 根据邮箱或电话查询广交会采购商数据
     */
    public List<Map<String, Object>> searchBuyerByValue(String value, String type) {
        try {
            List<BaseCantonFairBuyer> results;
            if ("email".equals(type)) {
                results = QueryUtil.safeExecuteQuery(() -> cantonFairBuyerMapper.searchBuyersByEmail(value, 0, 100));
            } else {
                results = QueryUtil.safeExecuteQuery(() -> cantonFairBuyerMapper.searchBuyersByPhone(value, 0, 100));
            }
            return results.stream().map(this::convertBuyerToMap).collect(Collectors.toList());
        } catch (Exception e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    }

    /**
     * 根据邮箱或电话查询广交会展商数据
     */
    public List<Map<String, Object>> searchExhibitorByValue(String value, String type) {
        try {
            List<BaseCantonFairExhibitor> results;
            if ("email".equals(type)) {
                results = QueryUtil.safeExecuteQuery(() -> cantonFairExhibitorMapper.searchExhibitorsByEmail(value, 0, 100));
            } else {
                results = QueryUtil.safeExecuteQuery(() -> cantonFairExhibitorMapper.searchExhibitorsByPhone(value, 0, 100));
            }
            return results.stream().map(this::convertExhibitorToMap).collect(Collectors.toList());
        } catch (Exception e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    }
} 